﻿using Microsoft.VisualStudio.Modeling.Diagrams;
using Microsoft.VisualStudio.Modeling;
using System.Drawing;
using System.Text;

namespace insa.rtos.dsl
{

    public partial class ServiceShape
    {
        /// <summary>
        /// Changes the delegate used to obtain the icon of the Method in an Interface shape
        /// </summary>
        /// <param name="melType"></param>
        /// <returns></returns>
        //protected override CompartmentMapping[] GetCompartmentMappings(global::System.Type melType)
        //{
        //    CompartmentMapping[] mappings = base.GetCompartmentMappings(melType);
        //    ElementListCompartmentMapping operationMapping = mappings[0] as ElementListCompartmentMapping;
        //    operationMapping.ImageGetter = GetElementImage;
        //    //operationMapping.ElementListGetter = GetElements;
        //    return mappings;
        //}


        /// <summary>
        /// Decides what the icon of the method will be in the interface shape
        /// </summary>
        /// <param name="mel"></param>
        /// <returns></returns>
        public Image GetElementImage(ModelElement mel)
        {
            Operation member = mel as Operation;
            if ((member != null))
            {
                //insa.rtos.dsl.Customcode.ResourceDSL.
                //string s = ASCIIEncoding.UTF8.GetString(insa.rtos.dsl.Customcode.ResourceDSL.test);
                return Image.FromFile("ExampleConnectorToolBitmap.bmp");
            }

            return null;            
        }
    }
}

